<template>
    <div>
        <h2>当前计数:{{counter}}</h2>
        <counter-operation @add="addone"
                           @sub="subone"
                           @addN="addNumber"></counter-operation>
                           
    </div>
</template>

<script>
    import CounterOperation from './CounterOperation.vue'

    export default {
        components: {
            CounterOperation
        },
        data() {
            return {
                counter: 0
            }
        },
        methods: {
            addone() {
                this.counter++
            },
            subone() {
                this.counter--
            },
            addNumber(num) {
                this.counter += num;
            }
        }
    }
</script>

<style scoped>

</style>